See Also

Trace Class  | Trace Members  | Overload List

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Language

Visual Basic

C#

C++

C++/CLI

Show All

remoteHost
The remote host to which to the route is traced.
data
Data to send along with the trace operation.
See Also Languages PowerTCP SSL Sockets for .NET

Send(String,Byte[]) Method

Dart.PowerTCP.SslSockets Namespace > Trace Class > Send Method : Send(String,Byte[]) Method

Trace a route to a host, specifying data to send.

[Visual Basic]
Overloads Public Function Send( _    ByVal remoteHost As String, _    ByVal data() As Byte _ ) As TraceResult
[C#]
public TraceResult Send(    string remoteHost,    byte[] data );
[C++]
public: TraceResult* Send(    string* remoteHost,    byte[]* data )
[C++/CLI]
public: TraceResult^ Send(    String^ remoteHost,    bytearray<data>^ data )

Parameters

remoteHost
The remote host to which to the route is traced.
data
Data to send along with the trace operation.

Return Type

A TraceResult encapsulating the entire trace operation.

Exceptions

ExceptionDescription
InvalidOperationExceptionBeginXXX method used without providing an EndXXX event handler.
SocketExceptionThe remote address is unknown, invalid, or unable to be resolved.

Remarks

Use this method to trace a route to the host specified by remoteHost. After calling this method, the Hop event is raised upon each hop. Check the event for information about the hop, such as the remote address of the particular host for this hop. Upon completion of this method, a TraceResult object is returned. This object will contain information about the trace operation in general, such as a collection representing all hops.

Example

The following example demonstrates a basic trace route operation.

[Visual Basic] 

Private Sub TraceTest()
   ' Set all hops and echoes to be synchronous
   Trace1.HopType = HopType.SynchHops

   ' Do not exceed 25 hops
   Trace1.MaxHops = 25

   ' Trace the route, specifying the data to send in the packet.
   ' Trace.Hop event will be raised when new hop data is available
   Dim data as byte() = System.Text.Encoding.Default.GetBytes("data data data");
   Dim tr As TraceResult = Trace1.Send("www.dart.com", data)

   ' Trace route complete. Display some data.
   Debug.WriteLine("Average time for final hop: " & tr.AverageTime)
   Debug.WriteLine("Number of hops: " & tr.Hops.Length)
   Debug.WriteLine("Remote Address: " & tr.RemoteAddress)
End Sub

Private Sub Trace1_Hop(ByVal sender As Object, ByVal e As HopEventArgs) Handles Trace1.Hop
   ' Display information about the hop
   Debug.WriteLine("Time-to-live for the hop: " & e.Result.TTL)
   Debug.WriteLine("Remote address: " & e.Result.RemoteAddress)

   ' Now display info about each of the three echoes
   Debug.WriteLine("Response times for this hop")
   Dim er As EchoResult
   For Each er In e.Result.Echoes
      Debug.WriteLine(er.ResponseTime)
   Next

   Debug.WriteLine("Average time for this hop: " & e.Result.AverageTime)
End Sub

[C#] 


private void TraceTest()
{
  
// Set all hops and echoes to be synchronous
  
trace1.HopType = HopType.SynchHops;

  
// Do not exceed 25 hops
  
trace1.MaxHops = 25;

  
// Trace the route, specifying the data to send in the packet.
  
// Trace.Hop event will be raised when new hop data is available
  
byte[] data = System.Text.Encoding.Default.GetBytes("data data data");
  TraceResult tr = trace1.Send(
"www.dart.com", data);

  
// Trace route complete. Display some data.
  
Debug.WriteLine("Average time for final hop: " + tr.AverageTime);
  Debug.WriteLine(
"Number of hops: " + tr.Hops.Length);
  Debug.WriteLine(
"Remote Address: " + tr.RemoteAddress);
}

private void trace1_Hop(object sender, HopEventArgs e)
{
  
// Display information about the hop
  
Debug.WriteLine("Time-to-live for the hop: " + e.Result.TTL);
  Debug.WriteLine(
"Remote address: " + e.Result.RemoteAddress);

  
// Now display info about each of the three echoes
  
Debug.WriteLine("Response times for this hop");
  
foreach(EchoResult er in e.Result.Echoes)
     Debug.WriteLine(er.ResponseTime);

  Debug.WriteLine(
"Average time for this hop: " + e.Result.AverageTime);
}
                

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Trace Class  | Trace Members  | Overload List


Send comments on this topic.

Documentation version 1.1.2.0.

© 2008 Dart Communications.  All rights reserved.